<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>入门案例</title>
</head>
<body>
<!--视图-->
<div id="div">
    <div>姓名:{{name}}</div>
    <div>班级:{{class1}}</div>
    <button onclick="hi()">打招呼</button>
    <button onclick="update()">修改班级</button>
</div>
</body>
<script src="js/vue.js"></script>
<script>
    //脚本
    let vm = new Vue({
        //获取div
        el: "#div",
        data: {
            name: "张三",
            class1: "黑马程序员"
        },
        methods: {
            study() {
                alert(this.name + "正在" + this.class1 + "学习");
            }
        }
    });

    function hi() {
        vm.study();
    }

    function update() {
       vm.class1="传智播客"
    }
</script>
</html>